<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改客户')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-customer-edit" th:object="${sysOaCustomer}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label ">客户编号：</label>
                <div class="col-sm-8">
                    <input name="customerNo" th:field="*{customerNo}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">客户名称：</label>
                <div class="col-sm-8">
                    <input name="customerName" th:field="*{customerName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">客户所属行业：</label>
                <div class="col-sm-8">
                    <select name="customerIndustry" class="form-control m-b" th:with="type=${@dict.getType('sys_industry_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{customerIndustry}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">所在省市区：</label>
                <div class="col-sm-8">
                    <div id="element_id">
                        <select class="province  form-control m-b" name="customerProvinceCode">
                            <option th:value="${sysOaCustomer.customerProvinceCode}" selected>[[${sysOaCustomer.customerProvinceName}]]</option>
                        </select>
                        <select class="city  form-control m-b" name="customerCityCode">
                            <option th:value="${sysOaCustomer.customerCityCode}" selected>[[${sysOaCustomer.customerCityName}]]</option>
                        </select>
                        <select class="area  form-control m-b" name="customerAreaCode" >
                            <option th:value="${sysOaCustomer.customerAreaCode}" selected>[[${sysOaCustomer.customerAreaName}]]</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">详细地址：</label>
                <div class="col-sm-8">
                    <textarea name="customerAddress" class="form-control" th:field="*{customerAddress}"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">客户来源：</label>
                <div class="col-sm-8">
                    <input name="customerSource" th:field="*{customerSource}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系人：</label>
                <div class="col-sm-8">
                    <input name="customerLinkeUser" th:field="*{customerLinkeUser}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">联系电话：</label>
                <div class="col-sm-8">
                    <input name="customerPhone" th:field="*{customerPhone}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">联系邮件：</label>
                <div class="col-sm-8">
                    <input name="customerEmail" th:field="*{customerEmail}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jquery-cxselect-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/customer";
        $("#form-customer-edit").validate({
            focusCleanup: true
        });
        $(function() {
            $('#element_id').cxSelect({
                url: '/system/region/getTreeData',
                selects: ['province', 'city', 'area'],
                nodata: 'none',
                jsonName: "name",
                jsonValue: "code",
                jsonSub:'children',
                required:true
            });
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-customer-edit').serialize());
            }
        }
    </script>
</body>
</html>